#ifdef CONFIG_ACPI
#ifdef XEN
-/**
- * Copy from linux/include/asm-generic/bug.h
- */
-#define WARN_ON(condition) do { \
- if (unlikely((condition)!=0)) { \
- printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
- dump_stack(); \
- } \
-} while (0)
-
/**
* Copy from linux/kernel/irq/manage.c
*
console_end_sync();
}
-void __warn(char *file, int line)
-{
- ulong sp;
- ulong lr;
-
- console_start_sync();
- printk("WARN at %s:%d\n", file, line);
-
- sp = (ulong)__builtin_frame_address(0);
- lr = (ulong)__builtin_return_address(0);
- backtrace(sp, lr, lr);
-
- console_end_sync();
-}
-
void dump_execution_state(void)
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
memcmp(bug.ud2, "\xf\xb", sizeof(bug.ud2)) ||
(bug.ret != 0xc2) )
goto die;
+ eip += sizeof(bug);
id = bug.id & 3;
- if ( id == BUGFRAME_rsvd )
- goto die;
if ( id == BUGFRAME_dump )
{
show_execution_state(regs);
- regs->eip += sizeof(bug);
+ regs->eip = (unsigned long)eip;
return EXCRET_fault_fixed;
}
- /* BUG() or ASSERT(): decode the filename pointer and line number. */
- ASSERT((id == BUGFRAME_bug) || (id == BUGFRAME_assert));
- eip += sizeof(bug);
+ /* WARN, BUG or ASSERT: decode the filename pointer and line number. */
if ( !is_kernel(eip) ||
__copy_from_user(&bug_str, eip, sizeof(bug_str)) ||
memcmp(bug_str.mov, BUG_MOV_STR, sizeof(bug_str.mov)) )
goto die;
+ eip += sizeof(bug_str);
filename = is_kernel(bug_str.str) ? (char *)bug_str.str : "<unknown>";
lineno = bug.id >> 2;
+ if ( id == BUGFRAME_warn )
+ {
+ printk("Xen WARN at %.50s:%d\n", filename, lineno);
+ show_execution_state(regs);
+ regs->eip = (unsigned long)eip;
+ return EXCRET_fault_fixed;
+ }
+
if ( id == BUGFRAME_bug )
{
printk("Xen BUG at %.50s:%d\n", filename, lineno);
panic("Xen BUG at %.50s:%d\n", filename, lineno);
}
- /* ASSERT(): decode the predicate string pointer. */
+ /* ASSERT: decode the predicate string pointer. */
ASSERT(id == BUGFRAME_assert);
- eip += sizeof(bug_str);
if ( !is_kernel(eip) ||
__copy_from_user(&bug_str, eip, sizeof(bug_str)) ||
memcmp(bug_str.mov, BUG_MOV_STR, sizeof(bug_str.mov)) )
goto die;
+ eip += sizeof(bug_str);
predicate = is_kernel(bug_str.str) ? (char *)bug_str.str : "<unknown>";
printk("Assertion '%s' failed at %.50s:%d\n",
void __bug(char *file, int line)
{
console_start_sync();
- printk("BUG at %s:%d\n", file, line);
+ printk("Xen BUG at %s:%d\n", file, line);
dump_execution_state();
- panic("BUG at %s:%d\n", file, line);
+ panic("Xen BUG at %s:%d\n", file, line);
for ( ; ; ) ;
}
+void __warn(char *file, int line)
+{
+ printk("Xen WARN at %s:%d\n", file, line);
+ dump_execution_state();
+}
+
/*
* Local variables:
* mode: C
#define __IA64_BUG_H__
#define BUG() __bug(__FILE__, __LINE__)
+#define WARN() __warn(__FILE__, __LINE__)
#endif /* __IA64_BUG_H__ */
#define move_irq(x)
-#define WARN_ON(condition) do { \
- if (unlikely((condition)!=0)) { \
- printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
- dump_stack(); \
- } \
-} while (0)
-
#ifdef nop
#undef nop
#endif
#define __POWERPC_BUG_H__
#define BUG() __bug(__FILE__, __LINE__)
+#define WARN() __warn(__FILE__, __LINE__)
#endif /* __POWERPC_BUG_H__ */
#endif
}
-extern void __warn(char *file, int line);
-#define WARN() __warn(__FILE__, __LINE__)
-#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
-
extern void __attn(void);
#define ATTN() __attn();
} __attribute__((packed));
#define BUGFRAME_dump 0
-#define BUGFRAME_bug 1
-#define BUGFRAME_assert 2
-#define BUGFRAME_rsvd 3
+#define BUGFRAME_warn 1
+#define BUGFRAME_bug 2
+#define BUGFRAME_assert 3
#endif /* __X86_BUG_H__ */
"ud2 ; ret $%c0" \
: : "i" (BUGFRAME_dump) )
+#define WARN() \
+ asm volatile ( \
+ "ud2 ; ret $%c0 ; .byte 0xbc ; .long %c1" \
+ : : "i" (BUGFRAME_warn | (__LINE__<<2)), \
+ "i" (__FILE__) )
+
#define BUG() \
asm volatile ( \
"ud2 ; ret $%c0 ; .byte 0xbc ; .long %c1" \
"ud2 ; ret $%c0" \
: : "i" (BUGFRAME_dump) )
+#define WARN() \
+ asm volatile ( \
+ "ud2 ; ret $%c0 ; .byte 0x48,0xbc ; .quad %c1" \
+ : : "i" (BUGFRAME_warn | (__LINE__<<2)), \
+ "i" (__FILE__) )
+
#define BUG() \
asm volatile ( \
"ud2 ; ret $%c0 ; .byte 0x48,0xbc ; .quad %c1" \
#include <asm/bug.h>
void __bug(char *file, int line) __attribute__((noreturn));
+void __warn(char *file, int line);
-#define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
+#define BUG_ON(p) do { if (p) BUG(); } while (0)
+#define WARN_ON(p) do { if (p) WARN(); } while (0)
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))